package org.easyx.core.entity;

import java.util.HashMap;
import java.util.Map;

import org.easyx.core.utils.ObjKit;
import org.easyx.core.utils.PropertiesUtil;

public class Constants {
	/**
     * 用户登录Session
     */
    public static final String SESSION_USER = "SESSION-USER";
    /**
     * 是否开启登录验证码功能：true 开启，false 关闭
     */
    public static boolean CAPTCHA_OPEN = false;
    /**
     * 是否开启通知公告自动刷新功能：true 开启，false 关闭
     */
    public static boolean NOTICE_AUTOLOADING_OPEN = false;
    /** 
     * 保存文件的目录，放在web目录、或一个指定的绝对目录下 
     */  
    public static final String UPLOAD_PATH = PropertiesUtil.getProperty("uploadFilePath", "upload");
    /** 
     * 图片文件保存的路径，放在web目录
     */  
    public static String IMG_SAVE_PATH = "upload/";
    /**
     * 资源类型
     */
    public static final int SysResource_MENU = 0;//菜单
    public static final int SysResource_BUTTON = 1;//按钮
	
 	/**
 	 * 视频文件类型list
 	 */
 	public static Map<String,String> videoFileTypeMap = new HashMap<String,String>();;
 	
 	static{
 		videoFileTypeMap.put("mp4视频", "video/mp4");
 		videoFileTypeMap.put("ogv视频", "video/ogg");
 		videoFileTypeMap.put("webm视频", "video/webm");
 		
 		if(ObjKit.isNotEmpty(PropertiesUtil.getProperty("CAPTCHA_OPEN"))){
 			CAPTCHA_OPEN = Boolean.valueOf(PropertiesUtil.getProperty("CAPTCHA_OPEN"));
 		}
 		
 		if(ObjKit.isNotEmpty(PropertiesUtil.getProperty("NOTICE_AUTOLOADING_OPEN"))){
 			NOTICE_AUTOLOADING_OPEN = Boolean.valueOf(PropertiesUtil.getProperty("NOTICE_AUTOLOADING_OPEN"));
 		}
 		
 		if(ObjKit.isNotEmpty(PropertiesUtil.getProperty("img.file.save.path"))){
 			IMG_SAVE_PATH =PropertiesUtil.getProperty("img.file.save.path");
 			if(!IMG_SAVE_PATH.endsWith("/")){
 				IMG_SAVE_PATH = IMG_SAVE_PATH +"/";
 			}
 		}
 		
 	}
}
